package com.dou.ourpro.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dou.ourpro.pojo.Article;
import com.dou.ourpro.pojo.Users;
import com.dou.ourpro.service.ArticleService;
import com.dou.ourpro.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.dou.ourpro.controller.loginController.users1;

/**
 * Created with IntelliJ IDEA 2021.1 x64
 *
 * @Author: 窦义超
 * @Date: 2021/11/2021/11/11/21:03
 * @Description:
 */
@RestController
@RequestMapping("/data")
public class DataController {
    @Autowired
    UsersService usersService;
    @Autowired
    ArticleService articleService;
    @GetMapping("/getLogin")
    public List<Users> getlogin(){
        List<Users> list = usersService.list();
        return list;
    }
    @GetMapping("/message")
    public Users getMessage(){
        QueryWrapper<Users> queryWrapper=new QueryWrapper<>();
        System.out.println(users1);
        queryWrapper.eq("user_name",users1.getUserName());
        queryWrapper.eq("user_password",users1.getUserPassword());
        Users one = usersService.getOne(queryWrapper);
        return one;
    }

    @GetMapping("/art")
    public List<Article> getart(){
        List<Article> list = articleService.list();
        return list;
    }
}
